<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
		<!--ios是否运行创建快捷启动方式-->
		<meta content="yes" name="apple-mobile-web-app-capable">
		<!--ios顶部通知栏的样式 黑色-->
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<!--遇到数字不让转成电话号码格式-->
		<meta content="telephone=no" name="format-detection">
		<script src="js/remstyle.js"></script>
		<link rel="stylesheet" href="assets/mui/css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="common/css/base.css" />
		<link rel="stylesheet" type="text/css" href="css/min_page.css" />
		<link rel="stylesheet" type="text/css" href="css/sameInfo.css" />
		<link rel="stylesheet" type="text/css" href="css/material_link.css" />
		<script type="text/javascript" src="js/vue.js"></script>
		<script type="application/javascript " src="js/jquery-1.7.2.min.js "></script>
		<script src="layer/layer.js"></script>
		<link rel="stylesheet" type="text/css" href="layer/skin/layer.css" />
		<script src="js/config.js"></script>
		<title>链接</title>
	</head>
	<style>

	</style>

	<body>
		<!--顶部-->
		<div class="top">
			<div class="top-one" onclick="javascript :history.back(-1);">
				<span><img src="img_page/right.png"/></span>
			</div>
			<div class="point">
				<img src="img_page/3point.png" />
			</div>
		</div>
		<!--内容列表-->
		<div class="phone_con">
			<div class="phone_list_a" v-for="v in phone_list" @click="choose_link($event)">
				<img class="phone_list_a_bgp" src="img_page/link_bgp1.png" v-if="v.template==2" />
				<img class="phone_list_a_bgp" src="img_page/link_bgp2.png" v-if="v.template==0" />
				<img class="phone_list_a_bgp" src="img_page/link_bgp3.png" v-if="v.template==1" />
				<img class="phone_list_a_bgp" src="img_page/link_bgp4.png" v-if="v.template==3" />
				<a class="link_con" :data-url="v.url">{{v.content}}</a>
			</div>
		</div>
		<!--底部-->
		<div class="phone_bottom">
			<button onclick="phone_manage()">管理</button>
			<button onclick="new_phone()">新建链接</button>
		</div>
	</body>
	
	
	<script type="text/javascript">
		var phone_list = new Vue({
			el: '.phone_con',
			data: {
				phone_list: []
			},
			created: function() {
				this.getList();
			},
			methods: {
				getList: function() {
					var that = this;
					$.ajax({
						type: "get",
						url: v_url + "/wechat/material/getUrlList",
						data: {
							c_user_id: c_user_id
						},
						async: true,
						success: function(res) {
							var list = res.data;
							that.phone_list = list
							console.log(that.phone_list);
						}
					});

				},
				choose_link: function(obj) {
					var aaaa = window.location.href;
	var bbbb = aaaa.substring(aaaa.indexOf('addToTo=') + 8,aaaa.length);
					console.log(v_param)
					var html = "<div class='phone_list_a'>" + $(obj.currentTarget).html() + "</div>"
					if(v_param) {
						$.ajax({
							type: "get",
							url: v_url + "/wechat/singlepage/saveContent",
							data: {
								id: v_param,
								content: html,
								c_user_id: c_user_id
							},
							async: false,
							success: function(res) {
								if(res.code == 200) {
									console.log("保存成功")
									window.location.href = bbbb;
								} else {
									console.log("保存失败")
								}
							}
						});
					}
				}

			}
		})

		function phone_manage() {
			window.location.href = 'material_link_manage.html?c_user_id=' + c_user_id
		}

		function new_phone() {
			window.location.href = 'material_link_edit.html?c_user_id=' + c_user_id
		}
	</script>

</html>